/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package documenteditor.entidade.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author gleidson.moura
 */
@Entity
@Table(name="CLIENTE_BRINDE")
@SequenceGenerator(name="GEN_CLIENTE_BRINDE", sequenceName="GEN_CLIENTE_BRINDE_ID")
public class ClienteBrinde implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    private ClienteBrindePK idClienteBrinde;

    @Column(name="DATA_AQUISICAO")
    @Temporal(TemporalType.DATE)
    private Date dataAquisicao;

    @ManyToOne(targetEntity=Usuario.class, fetch=FetchType.LAZY)
    @JoinColumn(name="FUNC_RESPONSAVEL_ENTREGA")
    private Usuario funcResponsavelEntrega;

    public ClienteBrindePK getId() {
        return idClienteBrinde;
    }

    public void setId(ClienteBrindePK idClienteBrinde) {
        this.idClienteBrinde = idClienteBrinde;
    }

    public Date getDataAquisicao() {
        return dataAquisicao;
    }

    public void setDataAquisicao(Date dataAquisicao) {
        this.dataAquisicao = dataAquisicao;
    }

    public Usuario getFuncResponsavelEntrega() {
        return funcResponsavelEntrega;
    }

    public void setFuncResponsavelEntrega(Usuario funcResponsavelEntrega) {
        this.funcResponsavelEntrega = funcResponsavelEntrega;
    }

    public ClienteBrindePK getIdClienteBrinde() {
        return idClienteBrinde;
    }

    public void setIdClienteBrinde(ClienteBrindePK idClienteBrinde) {
        this.idClienteBrinde = idClienteBrinde;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idClienteBrinde != null ? idClienteBrinde.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClienteBrinde)) {
            return false;
        }
        ClienteBrinde other = (ClienteBrinde) object;
        if ((this.idClienteBrinde == null && other.idClienteBrinde != null) || (this.idClienteBrinde != null && !this.idClienteBrinde.equals(other.idClienteBrinde))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "documenteditor.entidade.model.ClienteBrinde[id=" + idClienteBrinde + "]";
    }

}
